<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>今年圣诞 宝妈萌娃齐欢聚</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="format-detection" content="telephone=no"/>
    <link href="http://66xiaoqu.babytreeimg.com/css/inviteReward/christmas.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="wrapper">
    <div class="con">
        <img src="http://66xiaoqu.babytreeimg.com/images/christmas/top.png" class="top-pic">

        <div class="page1">
            <span class="page1-l"></span><span class="page1-r">
            <img src="http://66xiaoqu.babytreeimg.com/images/christmas/page1.png" class="page1-pic"/>
            <a href="javascript:;" class="btn join-a" onclick="toInvitePage()">
                <img id="yaoqing" src="http://66xiaoqu.babytreeimg.com/images/christmas/yq.png"></a></span>
        </div>
        <div class="page2">
            <div id="rule_img">
            <img  src="http://66xiaoqu.babytreeimg.com/images/christmas/rule.png"/>
            <a href="javascript:;" class="btn join-a" onclick="toInvitePage()"><img id="bottom_yaoqing"
                                                                                    src="http://66xiaoqu.babytreeimg.com/images/christmas/yq.png"></a><a href="javascript:;"
                                                                                                                                                   class="btn share" onclick="share()">
            <img  src="http://66xiaoqu.babytreeimg.com/images/christmas/share.png"></a>

            <div style="clear:both"></div>
            <img src="http://66xiaoqu.babytreeimg.com/images/christmas/bottom.png" class="bottom-pic"/></div>
        </div>
    </div>
</div>
<div class="pop" id="pop" onclick="popClick()">
    <img src="http://66xiaoqu.babytreeimg.com/images/christmas/share-tips.png">
</div>

</body>
</html>
<script src="http://66xiaoqu.babytreeimg.com/js/controller/acquisition.js"></script>
<script src="http://66xiaoqu.babytreeimg.com/js/lib/jquery-2.1.1.min.js" type="text/javascript"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="http://66xiaoqu.babytreeimg.com/js/controller/common.js"></script>
<script>
    var params = {};
    var tempArray = window.location.search.split('?');
    if (tempArray.length == 2) {
        var parts = tempArray[1].split('&');
        for (var i = 0; i < parts.length; i++) {
            var nv = parts[i].split('=');
            if (!nv[0]) continue;
            params[nv[0]] = nv[1] || true;
        }
    }

    if (params.type == 'out') {
        document.getElementById('yaoqing').src = 'http://66xiaoqu.babytreeimg.com/images/christmas/outsite-a.png';
        document.getElementById('bottom_yaoqing').src = 'http://66xiaoqu.babytreeimg.com/images/christmas/outsite-a.png';
    } else {
        document.getElementById('yaoqing').src = 'http://66xiaoqu.babytreeimg.com/images/christmas/yq.png';
        document.getElementById('bottom_yaoqing').src = 'http://66xiaoqu.babytreeimg.com/images/christmas/yq.png';
    }

    function share() {
        if (params.type == 'out') {
            $('#pop').css({top: $(document).scrollTop()});

            $('#wrapper').css({overflow: 'hidden'});
            document.getElementById('pop').style.display = 'block';

            clickAcquisition({
                type: 73,
                typeDesc: '圣诞站外分享'
            });

        } else {

            clickAcquisition({
                type: 71,
                typeDesc: '圣诞站内分享'
            });

            var title = '今年圣诞有惊喜，宝妈萌娃齐欢聚';
            var desc = '一个邀请，一份礼物，给宝贝找个一辈子的好伙伴，给自己找个志同道合的好闺蜜';
            var imageURL = 'http://66xiaoqu.babytreeimg.com/app/images/christmas/share_icon.jpg';
            var url = 'http://' + window.location.host + '/app/inviteReward/christmas.html?type=out';

            if (params.type == 'ios') {
                document.location.href = "66xiaoqu:market:share##title=" + title + "&nbsp;desc=" + desc + "&nbsp;image=" + imageURL + "&nbsp;url=" + url;
            } else {
                webviewhandle.shareGoodsDetail(title, desc, imageURL, url);//webviewhandle为webview注册对象
            }
        }
    }

    function popClick() {
        $('#wrapper').css({overflow: 'auto'});
        document.getElementById('pop').style.display = 'none';
    }

    function toInvitePage() {
        if (params.type == 'out') {
            clickAcquisition({
                type: 72,
                typeDesc: '圣诞站外下载'
            });

            toDownload();
        } else {
            var postData = {
                type: 70,
                typeDesc: '圣诞站内邀请'
            };
            clickAcquisition(postData);

            if (params.type == 'ios') {
                document.location.href = "66xiaoqu:toInvitePage##userId=" + params.token;
            } else {
                webviewhandle.goToInvitePage(params.token);//webviewhandle为webview注册对象
            }
        }
    }


    var ua = navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == "micromessenger") {
        var shareData = {
            title: '今年圣诞有惊喜，宝妈萌娃齐欢聚。',
            desc: '一个邀请，一份礼物，给宝贝找个一辈子的好伙伴，给自己找个志同道合的好闺蜜',
            imgUrl: 'http://66xiaoqu.babytreeimg.com/app/images/christmas/share_icon.jpg',
            link: 'http://' + window.location.host + '/app/inviteReward/christmas.html?type=out'
        };

        wx.ready(function () {
            wx.onMenuShareAppMessage({
                title: shareData.title,
                link: shareData.link,
                imgUrl: shareData.imgUrl,
                desc: shareData.desc,
                success: function () {
                    //showResult();
                }
            });
            wx.onMenuShareTimeline({
                title: shareData.title,
                link: shareData.link,
                imgUrl: shareData.imgUrl,
                success: function () {
                    //showResult();
                }
            });
            wx.onMenuShareQQ(shareData);
            wx.onMenuShareWeibo(shareData);
        });

        $.post('http://weixin-66xiaoqu.babytree.com/wxJs/getWxJsConfig.do', function (json) {
            timestamp = json.data.timestamp;
            appId = json.data.appId;
            nonceStr = json.data.nonceStr;
            signature = json.data.signature;
            shareT(appId, timestamp, nonceStr, signature);
        }, 'json');

        function shareT(appId, timestamp, nonceStr, signature) {
            wx.config({
                debug: false,
                appId: appId,
                timestamp: timestamp,      //生成签名的时间戳
                nonceStr: nonceStr,       //生成签名的随机串
                signature: signature,     //签名
                jsApiList: [
                    'checkJsApi',
                    'onMenuShareTimeline',
                    'onMenuShareAppMessage',
                    'onMenuShareQQ',
                    'onMenuShareWeibo'
                ]
            });
        }
    }
</script>
 